/**************************************************************************
 * Filename	: omx_Entry_ImageDecoderJpeg.c 			
 *
 * Description	: Entry of openmax Mepg4 Decoder Component
 *
 * Notes		:                                     
 *
 * Revisions:
 *     Author     		Date     		Version   	 Description
 *     yuyiwei 	    	2008.10.6 	    1.0.0       
 *   			   
 *********************************************************************/

#include "static_component_loader.h"
#include "omx_component_ImageDecoderJpeg.h"
#include "omx_comp_debug_levels.h"


int Omx_LibrarySetup_ImageDecoderJpeg(OmxWinLoaderComponentType **ppComponents)
{
    OmxWinLoaderComponentType *Component_jpeg;

    DEBUG(DEB_LEV_FUNCTION_NAME, "In %s \n", __func__);
    if (ppComponents == NULL)
    {
        DEBUG(DEB_LEV_FUNCTION_NAME, "Out of %s \n", __func__);
        return 1; // Return Number of Component/s
    }
    Component_jpeg = (OmxWinLoaderComponentType*)omx_calloc(1, sizeof(OmxWinLoaderComponentType));
    if (Component_jpeg == NULL)
    {
        return OMX_ErrorInsufficientResources;
    }

    Component_jpeg->componentVersion.s.nVersionMajor = 1;
    Component_jpeg->componentVersion.s.nVersionMinor = 1;
    Component_jpeg->componentVersion.s.nRevision = 1;
    Component_jpeg->componentVersion.s.nStep = 1;

    Component_jpeg->name = (char*)omx_malloc(OMX_MAX_STRINGNAME_SIZE);
    if (Component_jpeg->name == NULL)
    {
        return OMX_ErrorInsufficientResources;
    }
    strcpy(Component_jpeg->name, "OMX.dt.image.decoder.jpeg");
    Component_jpeg->name_specific_length = 1;
    Component_jpeg->constructor = omx_ImageDecoderJpeg_Constructor;

    Component_jpeg->name_specific = (char **)omx_calloc(Component_jpeg->name_specific_length, sizeof(char*));
    Component_jpeg->role_specific = (char **)omx_calloc(Component_jpeg->name_specific_length, sizeof(char*));

    Component_jpeg->name_specific[0] = (char*)omx_malloc(OMX_MAX_STRINGNAME_SIZE);
    if (Component_jpeg->name_specific[0] == NULL)
    {
        return OMX_ErrorInsufficientResources;
    }
    Component_jpeg->role_specific[0] = (char*)omx_malloc(OMX_MAX_STRINGNAME_SIZE);
    if (Component_jpeg->role_specific[0] == NULL)
    {
        return OMX_ErrorInsufficientResources;
    }

    strcpy(Component_jpeg->name_specific[0], "OMX.dt.image.decoder.jpeg");
    strcpy(Component_jpeg->role_specific[0], "image.decoder.jpeg");

#ifdef USE_RESOURCE_MANAGEMENT
    Component_jpeg->sComEntitiesQueue.sComEntitiesCount.nValue = 0;
    Component_jpeg->sComEntitiesQueue.sComEntitiesCount.nMin = 0;
    Component_jpeg->sComEntitiesQueue.sComEntitiesCount.nMax = 10;
    Component_jpeg->bActive = OMX_FALSE;
    Component_jpeg->sComEntitiesQueue.pHeader = NULL;
#endif

    *ppComponents = Component_jpeg;

    DEBUG(DEB_LEV_FUNCTION_NAME, "Out of %s \n", __func__);
    return 1;
}


